#!/usr/bin/env bash

echo $'\n'"=======  executing updateBakInfo.sh =============== "$'\n'


source jenkins/config

echo '' > bakInfo
for var in $deployIps
do
    if [ -z "$var" ] ; then continue
    fi
    ipTmp=${var#ip_}
    ip=${ipTmp//_/.}
    ssh $server_username@$ip "find $bakDir -name \"etrading-*\" -type d -exec basename {} \; | tr \"$'\n'\" ','" > /tmp/bakInfo$ip
    sed -i "/^$/d;s/,/@$ip,/g" /tmp/bakInfo$ip
#    sed -i "" /tmp/bakInfo$ip
    cat /tmp/bakInfo$ip >> bakInfo
done
sed -i "s/,$//g" bakInfo

